#set dates and plot histograms of interview dates
ESS6 <- tidyr::unite(ESS6, date, inwmms, inwdds, inwyys, sep = "/")
ESS6$date <- as.Date(ESS6$date, "%m/%d/%Y")

ESS7 <- tidyr::unite(ESS7, date, inwmms, inwdds, inwyys, sep = "/")
ESS7$date <- as.Date(ESS7$date, "%m/%d/%Y")

ESS8 <- tidyr::unite(ESS8, date, inwmms, inwdds, inwyys, sep = "/")
ESS8$date <- as.Date(ESS8$date, "%m/%d/%Y")

ESS9 <- tidyr::unite(ESS9, date, inwmms, inwdds, inwyys, sep = "/")
ESS9$date <- as.Date(ESS9$date, "%m/%d/%Y")

ESS10 <- tidyr::separate(ESS10, inwds, c("date", "time"), sep = " ")
ESS10$date <- as.Date(ESS10$date)

par(mfrow = c(1, 2))
hist6 <- hist(ESS6$date, breaks = 500,
              main="Wave 6",
              xlab="Date",
              cex.lab = 2,
              cex.axis = 2,
              cex.main = 3,
              xaxt = "n")
axis(1, 
     ESS6$date,
     format(ESS6$date, "%Y-%m-%d"),
     cex.axis = 2)


hist7 <- hist(ESS7$date, breaks = 500,
              main="Wave 7",
              xlab="Date",
              cex.lab = 2,
              cex.axis = 2,
              cex.main = 3,
              xaxt = "n")
axis(1, 
     ESS7$date,
     format(ESS7$date, "%Y-%m-%d"),
     cex.axis = 2)


par(mfrow = c(1, 3))
hist8 <- hist(ESS8$date, breaks = 500,
              main="Wave 8",
              xlab="Date",
              cex.lab = 2,
              cex.axis = 2,
              cex.main = 3,
              xaxt = "n")
axis(1, 
     ESS8$date,
     format(ESS8$date, "%Y-%m-%d"),
     cex.axis = 2)


hist9 <- hist(ESS9$date, breaks = 500,
              main="Wave 9",
              xlab="Date",
              cex.lab = 2,
              cex.axis = 2,
              cex.main = 3,
              xaxt = "n")
axis(1, 
     ESS9$date,
     format(ESS9$date, "%Y-%m-%d"),
     cex.axis = 2)


hist10 <- hist(ESS10$date, breaks = 500,
               main="Wave 10",
               xlab="Date",
               cex.lab = 2,
               cex.axis = 2,
               cex.main = 3,
               xaxt = "n")
axis(1, 
     ESS10$date,
     format(ESS10$date, "%Y-%m-%d"),
     cex.axis = 2)


### plotting italian dates ###
par(mfrow = c(1,2))

ita6 <- ESS6 %>% 
  filter(cntry == "IT")
histita6 <- hist(ita6$date, breaks = 500,
                 main="Wave 6",
                 xlab="Date",
                 cex.lab = 2,
                 cex.axis = 2,
                 cex.main = 3,
                 xaxt = "n")
axis(1, 
     ita6$date,
     format(ita6$date, "%Y-%m-%d"),
     cex.axis = 2)


ita8 <- ESS8 %>% 
  filter(cntry == "IT")
histita8 <- hist(ita8$date, breaks = 500,
                 main="Wave 8",
                 xlab="Date",
                 cex.lab = 2,
                 cex.axis = 2,
                 cex.main = 3,
                 xaxt = "n")
axis(1, 
     ita8$date,
     format(ita8$date, "%Y-%m-%d"),
     cex.axis = 2)


ita9 <- ESS9 %>% 
  filter(cntry == "IT")
histita9 <- hist(ita9$date, breaks = 500,
                 main="Wave 9",
                 xlab="Date",
                 cex.lab = 2,
                 cex.axis = 2,
                 cex.main = 3,
                 xaxt = "n")
axis(1, 
     ita9$date,
     format(ita9$date, "%Y-%m-%d"),
     cex.axis = 2)


ita10 <- ESS10 %>% 
  filter(cntry == "IT")
histita10 <- hist(ita10$date, breaks = 500,
                  main="Wave 10",
                  xlab="Date",
                  cex.lab = 2,
                  cex.axis = 2,
                  cex.main = 3,
                  xaxt = "n")
axis(1, 
     ita10$date,
     format(ita10$date, "%Y-%m-%d"),
     cex.axis = 2)
